package com.aaa.dem1109.观察者模式;

import java.util.ArrayList;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/9  18:21
 */
public class AAApublic implements IPoblic{

    private String msg;
    private ArrayList<UserInterfacr> list = new ArrayList<UserInterfacr>();

    @Override
    public void guanzhu(UserInterfacr userInterfacr) {
        list.add(userInterfacr);
    }

    @Override
    public void quxiao(UserInterfacr userInterfacr) {
        list.remove(userInterfacr);
    }

    @Override
    public void setMsg(String msg) {
        this.msg=msg;
    }

    @Override
    public void qunfa() {
        for (UserInterfacr userInterfacr : list) {
            userInterfacr.getMsg(msg);
        }
    }
}
